import { defineStore } from "pinia";
import { ref } from "vue";
import { storage } from "../utils";

// 本地缓存
const data = storage.info();

const useCacheStore = defineStore("cache", function () {
	const lang = ref(data.lang || "zh");
	function setLang(e: string) {
		lang.value = e;
		storage.set("lang", e);
	}
	return {
		lang,
		setLang,
	};
});

export { useCacheStore };
